using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using GUI.Utils;

namespace GUI.Controls;

internal class ThemedContextMenuStrip : ContextMenuStrip
{
    public ThemedContextMenuStrip(IContainer container) : base()
    {
        // this constructor ensures ContextMenuStrip is disposed properly since its not parented to the form.
        ArgumentNullException.ThrowIfNull(container);

        container.Add(this);
    }

    public new Size ImageScalingSize
    {
        get => base.ImageScalingSize;
        set => base.ImageScalingSize = new Size(this.AdjustForDPI(value.Width), this.AdjustForDPI(value.Height));
    }

    protected override void OnCreateControl()
    {
        base.OnCreateControl();

        Themer.ThemeControl(this);
    }
}
